package com.taotao.st3.conf;

import com.github.pagehelper.PageInterceptor;
import com.taotao.st3.base.mybatis.plugin.MysqlLikeParamEscapeInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;


@Configuration
@MapperScan("com.taotao.*.dao*")
public class MybatisConfig {

 
	/**
	 * 分页插件
	 */
	@Bean
	public PageInterceptor pageInterceptor() {
		PageInterceptor pageInterceptor0 = new PageInterceptor();
		Properties properties = new Properties();
		properties.put("helperDialect", "mysql");
		//参数方法调用
		properties.put("supportMethodsArguments", "true");
		
		pageInterceptor0.setProperties(properties);
		return pageInterceptor0;
	}



//	@Bean
//	MatcherLikeParamEscapeInterceptor likeStringEscapeInterceptor(){
//		return new MatcherLikeParamEscapeInterceptor();
//	}



	@Bean
	MysqlLikeParamEscapeInterceptor mysqlLikeParamEscapeInterceptor(){
		return new MysqlLikeParamEscapeInterceptor();
	}

}